#ifndef __SEARCH_EXT_H_H_
#define __SEARCH_EXT_H_H_

#include "stdint.h"
#include "mytype.h"

#ifdef __cplusplus
extern "C"
{
#endif

	int16_t str_list_search_str(const char **list, const char *str); 

	int binary_search_num(int (*get_attr_val)(int), int val, int Len);
	int binary_search_str_list(const char **str_list, const char *str, int Len); 

	int16_t search32(void *list, int16_t len, uint32_t dat);
	int16_t search16(void *list, int16_t len, uint16_t dat);
	int16_t search8(void *list, int16_t len, uint8_t dat);

	int dat_u8_search(const uu8 *list, uu8 dat, int len);
	int dat_u16_search(const uu16 *list, uu16 dat, int len);
	int dat_u32_search(const uu32 *list, uu32 dat, int len);

	int dat_u8_nsearch(const uu8 *list, uu8 dat, int len);
	int dat_u16_nsearch(const uu16 *list, uu16 dat, int len);
	int dat_u32_nsearch(const uu32 *list, uu32 dat, int len);

	typedef struct
	{
		int32_t des_site;									
		int32_t siteStart;									
		int32_t siteEnd;									
		int32_t element_amount;								
		void *cfg;											
		uint32_t (*get_val)(const void *cfg, int32_t site); 
	} binary_search_list_u32_type;

	typedef struct
	{
		int32_t des_site;								   
		int32_t siteStart;								   
		int32_t siteEnd;								   
		int32_t element_amount;							   
		void *cfg;										   
		int32_t (*get_val)(const void *cfg, int32_t site); 
	} binary_search_list_i32_type;

	void binary_search_list_u32(binary_search_list_u32_type *cfg, uint32_t des_val, int8_t mode);
	void binary_search_list_i32(binary_search_list_i32_type *cfg, int32_t des_val, int8_t mode);

	int32_t mem_data_tail_search(ii8 (*get_used_st)(void *, int32_t site), int32_t site_amount, void *argv);

#ifdef __cplusplus
}
#endif

#endif 
